#include "edge_laplacian.h"

EdgeLaplacian::EdgeLaplacian(PNM* img) :
    Convolution(img)
{
	sizeSet = false;
}

EdgeLaplacian::EdgeLaplacian(PNM* img, ImageViewer* iv) :
    Convolution(img, iv)
{
	sizeSet = false;
}

math::matrix<double> EdgeLaplacian::getMask(int, Mode)
{
    int size = getParameter("size").toInt();

	if(sizeSet)
		size = m_size;

    math::matrix<double> mask(size, size);

	for (int i = 0; i < size; i++)
	{
		for (int j = 0; j < size; j++)
		{
			if(i == (size / 2) && j == (size / 2)) mask(i, j) = size*size - 1;
			else mask(i,j) = -1;
		}
	}

    return mask;
}

void EdgeLaplacian::setSize(int _size)
{
	m_size = _size;
	sizeSet = true;
}

